package com.alibaba.citrus.cr.unified.inventory.facade.service;

import com.alibaba.lattice2.epoch.sdk.model.Result;
import com.epoch.app.crunifiedinventory.api.transportmoderead.service.TransportModeReadService;
import com.epoch.app.crunifiedinventory.dto.response.TransportModeDTO;
import com.epoch.app.crunifiedinventory.sdo.enums.TransportModeEnum;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class TransportModeReadServiceImpl implements TransportModeReadService {
    @Override
    public Result<List<TransportModeDTO>> queryTransportMode() {
        TransportModeEnum[] list = TransportModeEnum.values();
        List<TransportModeDTO> transportModeDTOS = new ArrayList<>();
        for (TransportModeEnum transportModeEnum:list){
            TransportModeDTO transportModeDTO = new TransportModeDTO();
            transportModeDTO.setValue(transportModeEnum.getCode());
            transportModeDTO.setLabel(transportModeEnum.getDesc());
            transportModeDTOS.add(transportModeDTO);
        }
        return Result.success(transportModeDTOS);
    }
}
